import random
import json

def generate_cases():
    cases = []
    
    # 功能测试用例
    cases.append({"nums": [], "expected": -1})  # 空数组
    cases.append({"nums": [1], "expected": 0})  # 单元素
    cases.append({"nums": [1, 2, 3], "expected": -1})  # 无中心点
    cases.append({"nums": [2, 1, -1], "expected": 0})  # 中心在首部
    cases.append({"nums": [0, 0, 1], "expected": 2})  # 中心在尾部
    cases.append({"nums": [1, 7, 3, 6, 5, 6], "expected": 3})  # 中心在中部
    cases.append({"nums": [0, 0, 0, 0], "expected": 0})  # 多解取最左
    cases.append({"nums": [-1, -1, 0, 1, 1], "expected": 2})  # 含负数
    cases.append({"nums": [10, 5, 5, 10], "expected": 1})  # 多解验证
    
    # 边界压力测试
    cases.append({
        "nums": [1000]*5000 + [-1000]*5000, 
        "expected": -1
    })
    cases.append({
        "nums": [-1000]*9999 + [9999000],
        "expected": 9999
    })
    
    # 大数组性能测试
    large_array = [1]*10000
    large_array[5000] = 0
    cases.append({
        "nums": large_array,
        "expected": 5000
    })
    
    return cases

def save_cases(cases, filename="test_cases.json"):
    with open(filename, "w") as f:
        json.dump(cases, f, indent=2)

if __name__ == "__main__":
    test_cases = generate_cases()
    save_cases(test_cases)
    print(f"Generated {len(test_cases)} test cases")